<?php
        define("GRID_SOURCE", "");
        include(GRID_SOURCE."class/gridclasses.php"); //Include the grid engine.

        session_start();
		require_once "../funciones.php";	
        $grid_id = array("grid");
        unset($_SESSION["grid"]);
        include(GRID_SOURCE."class/gridcreate.php"); //Creates grid objects.
?>
<html>
        <head>
            <title>Movimientos</title>
            <script language="Javascript" type="text/javascript" src="<?php print(GRID_SOURCE);?>javascript/javascript.js"></script>
            <link rel="stylesheet" type="text/css" media="screen" href="../css/caweb.css" />
            <link href="<?php print(GRID_SOURCE);?>css/style.css" rel="stylesheet" type="text/css">
			<script type='text/javascript' src="<?php print(GRID_SOURCE);?>server.php?client=all"></script>
			<script>
			HTML_AJAX.defaultServerUrl = '<?php print(GRID_SOURCE);?>server.php';
			</script>
			<script src="caweb2.js"></script>
            <script src="../js/jquery.js" type="text/javascript"></script>
            <script src="../js/caweb.js" type="text/javascript"></script>
        </head>

        <body onload="funcion_focus();">

<?php

		if ($_SESSION['caweb']['iniciar'] == 1)
		{
		?>
		<form name="spe" method="POST" action="adiciona_spe_cant.php">
            
            
            <table boder=0>
                <tr>
                    <td>
                    <div><label for="clasetx">Clase</label>
                        <select name="clase" id="clasetx" class="mayusculas" onchange="funcion_subclases(this.value,1,'1');funcion_pasasesion('clase',this.value);">
                        <option value='' SELECTED>Seleccionar..</option>
                        <?php
                            $link_intranetpccom = con_intranetpccom();
                            $sql ="select cla.codigoclase,cla.descripcion from taxonomia tax
                                    inner join clases cla on tax.codigoclase = cla.codigoclase and cla.estado = 1
                                    where tax.porcantidad = 'Si' and tax.estado = 1
                                    group by codigoclase order by cla.descripcion";
                            $result64=mysql_query($sql,$link_intranetpccom) or die('Error Clase, '.mysql_error().$sql);
                            while($row64 = mysql_fetch_array($result64)){
                                echo "<option value='{$row64['codigoclase']}'>{$row64['descripcion']}</option>";
                            }
                        ?>
                    </select>
                    </div>
            </td>
            <td>
                <div id="layer2_subclases"></div>
            </td>
            <td>
                <div id="layer2_familias"></div>
            </td>
            <td>
                <div id="layer2_grupos"></div>
            </td>
            </tr>
                <tr>
                    <td colspan="4">
                    Cantidad :<input type="text" id="cantidad" size="5" name="cantidad" value="">
                    <input name="guardar" type="submit" value="Adicionar" />
                    </td>
                </tr>
			</table>
    	</form>

		Interno :<input type="text" id="Editbox1" onkeypress="funcion_validar_spe(event,this.value);" 
		size="15" name="Editbox1" value="" />

	<?php
        $link_caweb = con_caweb();
			$transaccion=$_SESSION['caweb']['consecutivo'];
			$bodegaactualitem=$_SESSION['caweb']['bodegaactualitem'];
			$sucursalactualitem=$_SESSION['caweb']['sucursalactualitem'];
			echo  "Ultimo Interno ".$_SESSION['caweb']['ultimointerno'];
			if ($_SESSION['caweb']['resultado'] == 0) { echo "<font color=red><b> NO existente</b></font>"; }
		 	if ($_SESSION['caweb']['resultado'] == 1) { echo "<font color=green><b> CORRECTO </b></font>"; }
			if ($_SESSION['caweb']['resultado'] == 2) { echo "<font color=black><b> Sin datos </b></font>"; }
            if ($_SESSION['caweb']['resultado'] == 3) { echo "<font color=red><b> INTERNO YA ESTA EN ESTA TRANSACCION ($transaccion) </b></font>"; }
            if ($_SESSION['caweb']['resultado'] == 4) { echo "<font color=red><b> ERROR.. bodega </b></font> $bodegaactualitem "; }
            if ($_SESSION['caweb']['resultado'] == 5) { echo "<font color=red><b> ERROR.. sucursal </b></font> $sucursalactualitem "; }
            if ($_SESSION['caweb']['resultado'] == 6) { echo "<font color=red><b> ERROR.. INTERNO NO asignado </b></font> "; }
            if ($_SESSION['caweb']['resultado'] == 7) { echo "<font color=red><b> ERROR.. INTERNO SIN oi </b></font> "; }
            if ($_SESSION['caweb']['resultado'] == 8) { echo "<font color=red><b> ERROR.. ADITAMENTO NO Asignado </b></font> "; }
			if ($_SESSION['caweb']['resultado'] == 9) { echo "<font color=red><b> ERROR.. EXCEDE EN EL ADITAMENTO </b></font>"; }
			if ($_SESSION['caweb']['resultado'] == 10) { echo "<font color=red><b> ERROR.. NO HAY SALDO de ESTE Aditamento en Bodega 03</b></font>"; }
                 
			$consecutivo=$_SESSION['caweb']['consecutivo'];
			$condicion="transaccion='$consecutivo'";
            $_SESSION["grid"]->SetDatabaseConnection($_SESSION['caweb']['basededatos'], "caweb", "caweb");

            $_SESSION["grid"]->SetSqlSelect('id, interno, item, cantidad, estado, precio, observacion', 'temporal', $condicion);
			$_SESSION["grid"]->SetUniqueDatabaseColumn("id", false);
			$_SESSION["grid"]->SetTitleName("Transaccion ($transaccion) -  Internos SALIDA PARA PEDIDO");
			$_SESSION["grid"]->SetEditModeEdit(true);
			$_SESSION["grid"]->SetMaxRowsEachPage(15);
       	    $_SESSION["grid"]->SetDatabaseColumnEditable("id", false);
			$_SESSION["grid"]->SetDatabaseColumnEditable("interno", false);
			$_SESSION["grid"]->SetDatabaseColumnEditable("cantidad", true);
            $_SESSION["grid"]->SetDatabaseColumnEditable("item", false);
       	    $_SESSION["grid"]->SetDatabaseColumnEditable("precio", true);
            $_SESSION["grid"]->SetDatabaseColumnEditable("estado", true);
            $_SESSION["grid"]->SetDatabaseColumnEditable("observacion", true);
			$_SESSION["grid"]->SetShowExcelIco(false);
			$_SESSION["grid"]->SetShowPrintIco(true);
			$_SESSION["grid"]->PrintGrid(MODE_EDIT);
	}
	?>
 </body> 
</html>